package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test01 {
    public static void main(String[] args) throws IOException {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入内容,单独输入exit是程序退出");
        FileOutputStream fos=new FileOutputStream("note.txt");
        OutputStreamWriter osw=new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        while (true){
            String str=scanner.next();
            if ("exit".equalsIgnoreCase(str)){
                break;
            }
            osw.write(str);
        }
        osw.close();
    }
}
